package com.itheima.controller;

import com.itheima.pojo.Result;
import com.itheima.utils.JwtUtil;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
@RequestMapping("/article")
public class ArticleController {

    @GetMapping("/list")
    public Result<String> list(/**@RequestHeader(name = "Authorization") String token, HttpServletResponse response**/){
//        if (token == null){
//            return Result.error("令牌为空");
//        }
//        try {
//            Map<String, Object> map = JwtUtil.parseToken(token);
//            return Result.success("文章列表...");
//        }catch (Exception e){
//            //set 404
//            response.setStatus(401);
//            return Result.error("未登录");
//        }
        //添加过滤器统一过滤
        return Result.success("文章列表...");


    }

}
